﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class Pages_VoteResult : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            try
            {
                DataSet ds = new DataSet();
                ds.ReadXml(Server.MapPath("~/upload/xml/vote.xml"));

                DataTable objDT = ds.Tables[0];
                if (objDT.Rows.Count > 0)
                {
                    //string VOTE_ANSWERS = objDT.Rows[0]["VOTE_ANSWERS"].ToString();
                    txtTitle.Text = objDT.Rows[0]["QUESTION"].ToString();
                    txtTotal.Text = "Tổng cộng: " + objDT.Rows[0]["TOTAL"].ToString() + " phiếu";
                    //string[] listVote = VOTE_ANSWERS.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    //rblVote.Items.Clear();
                    //foreach (string perVote in listVote)
                    //{
                    //    string[] allInfo = perVote.Split(new string[] { ":*:" }, StringSplitOptions.RemoveEmptyEntries);
                    //    rblVote.Items.Add(new ListItem(allInfo[1], allInfo[1]));
                    //}
                }
                objDT = ds.Tables[1];
                txtDate.Text = DateTime.Now.ToString();
                rptVote.DataSource = objDT;
                rptVote.DataBind();

            }
            catch { throw; }
        }
    }
}